﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="房产销冠, 房地产,卡考网络" />
    <meta name="description" content="上海卡考网络有限公司" />
    <title>房产销冠</title>
    <link rel="stylesheet" href="css/list.css" type="text/css" />
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link href="bootstrap/iCheck-master/skins/minimal/Orange.css" rel="stylesheet" type="text/css" />
    <!--<script src="js/jquery-1.8.3.min.js"></script>-->
    <!--<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />-->
    <script src="http://dn-blqw.qbox.me/jq+bs+art.js" type="text/javascript"></script>
    <!--<script src="js/jquery.easydropdown.min.js"></script>-->
    <script src="bootstrap/iCheck-master/icheck.js"></script>
    <!--<script src="bootstrap/js/bootstrap.min.js"></script>-->
    <!--<script src="js/checkbox.js"></script>-->
    <script src="js/common.js"></script>
    <script src="js/PageIndex.js"></script>
    <script src="http://dn-blqw.qbox.me/kk.js"></script>
    <script src="js/WdatePicker.js"></script>
    <!--<script src="http://static.tops001.com/openSource/iDialog/1.1/jquery.iDialog.js" dialog-theme="default"></script>-->
    <script src="Scripts/jquery.iDialog.js" dialog-theme="default"></script>
    <style>
        #selbox{}
        #selbox table{line-height:35px}
        #selbox table th{font-size:16px;}
        #selbox table td{font-size:14px}
        #selbox select {margin-right:20px}
    </style>
</head>
<body style="background: #f1f1f1;">
    <div class="main01">
        <div class="content clearfix">
            <div class="headline02">
                <div class="line_left">经纪人积分查询<span>(<b id="RecordCount">0</b>)</span></div>
                <div class="line_right">
                    <ul class="nav_line_right">
                        <li class="con"><a href="#">首页</a></li>
                        <li>/</li>
                        <li class="con"><a href="#">系统管理</a></li>
                        <li>/</li>
                        <li class="con"><a href="#" style="color: #60b12a;">经纪人积分管理</a></li>
                    </ul>
                </div>
            </div>
            <div class="bton">
                <div class="bton_left">
                    <input type="text" class="selall sel100 fl" id="brokerPhone" style="margin-right:11px;margin-top:5px;width:200px;" placeholder="经纪人电话" onkeyup="clearNoPhone_Number(this)" maxlength="11" onkeypress="    if (event.which == 13) { clearNoPhone_Number($('#brokerPhone').val()); this.blur(); }" />
                    <input type="submit" value="搜索" class="sbtn fl" onclick="f_Search()" style="margin-top:5px;" />  
                 </div>
                <div class="bton_right" style="margin-top:5px;">
                    <div class="bton_left_nav">
                        <!--<a href="#" class="btn_craise" style="border:1px solid #e3e4e6;margin-right:10px;" onclick="f_AuditKids()">审核</a>
                        <a href="#" class="btn_export" onclick="f_ExportExcel()" style="border:1px solid #e3e4e6;">导出</a>
                        <a href="" id="DownLoad" target="_blank" class="btn_export" style="display:none">下载</a>-->
                    </div>
                    <div class="bton_left_nav pageIn2">
                    </div>
                </div>
            </div>
        </div>
        

        <div style="min-height: 500px;">
            <table class="table03" style="width: 100%; max-height: 400px; table-layout: fixed; border-bottom: 1px #e6e6e6 solid;">
                <thead>
                    <tr class="info_title">
                        <th style="width: 60px" class="mid_line">序号</th>
                        <th style="width: 60px" class="mid_line">类型</th>
                        <th style="width: 120px;" class="mid_line">城市</th>
                        <th style="width: 100px;" class="mid_line">姓名</th>
                        <th style="width: 120px" class="mid_line">手机号</th>
                        <th style="width: 200px;" class="mid_line">公司名</th>
                        <th style="width: 100px;" class="mid_line">总积分</th>
                        <th style="width: 100px;" class="mid_line">剩余积分</th>
                        <th style="width: 100px;" class="mid_line">已兑换积分</th>
                        <th style="width: 200px">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="info_cont" style="display:none">
                        <td>{F_Index}</td>
                        <td>{F_UserType}</td>
                        <td>{F_CityName}</td>
                        <td>{F_UserName} </td>
                        <td>{F_UserPhone}</td>
                        <td>{F_CompanyName}</td>
                        <td>{F_PointAll}</td>
                        <td>{F_PointBalance}</td>
                        <td>{F_PointCash}</td>
                        <td>{F_Operate}</td>
                    </tr>
                </tbody>
            </table>
            <!--放置分页 begin -->
            <table style="width: 100%; height: auto">
                <tr>
                    <td colspan="15">
                        <div class="pageIn"></div>
                    </td>
                </tr>
            </table>
            <!--放置分页 end -->
        </div>

        <div id="selbox" class="clearfix" style="display:none">
            <div>
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>行为</th><th>积分</th><th>时间</th><th>楼盘ID</th><th>兑换记录ID</th>
                        </tr>
                    </thead>
                    <tbody id="showbox_tb"></tbody>
                </table>
                <select id="pageSel" class="selall sel100 fr"></select>
            </div>
        </div>
    </div>
    <script src="js/list.js"></script>
    <script type="text/javascript">
        $(function () {
            f_Search();
            $("#pageSel").on("change", function () {
                var pointId = $(this).data("pointId");
                var index = $(this).val();
                getDetail(pointId,index);
            })
        });

        var PageIndex = 1;
        function f_Search() {
            pageIndex = 1;
            f_GetData(pageIndex);
        }

        function f_UrlParStr() {
            var phone = $('#brokerPhone').val();
            return "?userPhone=" + phone;
        }

        //获取记录信息
        function f_GetData(pageIndex) {
            var pageSize = 8;
            var idx = 0;
            var newUrlParStr = f_UrlParStr();
            $kk.api.get("/Point/GetUserPointMain" + newUrlParStr, { pageSize: pageSize, pageIndex: pageIndex }, function (res) {
                kk.fillTable(".table03", res.Items, function (data, name) {
                    if (name == "F_Index") {
                        idx++;
                        var otherCount = pageSize * (pageIndex - 1);
                        if (isNaN(otherCount)) {
                            otherCount = 0;
                        }
                        return idx + otherCount;
                    }
                    if (name === "F_Operate") {
                        return "<div class='reset'><a href=\"javascript:;\" onclick=\"f_LookPointDetail('" + data["PointId"] + "')\" class=\"btn_revise\">查看明细</a></div>";
                        //return "<a href=\"javascript:;\" onclick=\"f_EditPoint('" + data["F_UserToken"] + "','" + data["F_PointAll"] + "','" + data["F_PointBalance"] + "','" + data["F_PointCash"] + "')\" class=\"btn_revise\">修改积分</a>";
                    }
                });
                $("#RecordCount").html(res.Count);
                makePageBar(f_GetData, res.Count, pageIndex, pageSize);
                PageIndex = pageIndex;
                $(':checkbox').not(".notneeddraw").iCheck({
                    checkboxClass: 'icheckbox_minimal-orange',
                    radioClass: 'iradio_minimal-orange',
                    increaseArea: '20%' // optional
                });
                $('#checkAll').css('display', 'block');
                $('.info_title .iCheck-helper').on('click', function () {
                    if ($(".icheckbox_minimal-orange:first").hasClass("checked")) {
                        $('.subBox').iCheck('check');
                    } else {
                        $('.subBox').iCheck('uncheck');
                    }
                });
                $('.pageIn').on('click', function () {
                    //console.log(111);
                    $('.checked:first').iCheck('uncheck');
                })
            });
        }

        //编辑
        function f_EditPoint(userToken, pointAll, pointBalance, pointCash) {
            
            kk.confirm(
                '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总积分：<input type="text" name="name" value="' + pointAll + '" id="PointAll" /><br/><br/>' +
                '&nbsp;&nbsp;&nbsp;剩余积分：<input type="text" name="name" value="' + pointBalance + '" id="PointBalance" /><br/><br/>' +
                '已兑换积分：<input type="text" name="name" value="' + pointCash + '" id="PointCash" />'
                , "编辑", "", "", function () {
                    var PointAll = $('#PointAll').val();
                    var PointBalance = $('#PointBalance').val();
                    var PointCash = $('#PointCash').val();
                    kk.api.get("/Point/SetUserPointMain", { userToken: userToken, pointAll: PointAll, pointBalance: PointBalance, pointCash: PointCash }, function (res) {
                        if (res) {
                            $kk.popup("操作成功", "success", 1000);
                            f_GetData(PageIndex);
                        } else {
                            $kk.popup("操作失败", "danger", 1000);
                        }
                    });
                }, null);
        }

        
        function f_LookPointDetail(PointId) {
            showWindows("查看积分明细", "selbox", '', 600, 600);
            getDetail(PointId,1);
        }

        function getDetail(PointId,index) {
            var showbox = $('#showbox_tb');
            $kk.api.get("/PointDetail/GetUserPointDetail", { pointId: PointId, pageSize: 10, pageIndex: index }, function (res) {
                var options = "";
                for (var i = 1; i < Math.ceil(res.Count / 10) + 1; i++) {
                    if (index == i) {
                        options += "<option selected='selected' value='" + i + "'>第" + i + "页</option>";
                    } else {
                        options += "<option value='" + i + "'>第" + i + "页</option>";
                    }
                }
                showbox.empty();
                $("#pageSel").html(options).data("pointId", PointId);
                $.each(res.Items, function (index, data) {
                    showbox.append('<tr><td>' + data["F_PointAction"] + '</td><td>' + data["F_Point"] + '</td><td>' + data["F_AddTime"] + '</td><td>' + data["F_BuildingKid"] + '</td><td>' + data["F_ProductExchangeKid"] + '</td></tr>');
                });
            });
        }

        function showWindows(title, id, func, wt, h) {
            $.dialog({
                height: h,
                width: wt,
                fixed: true,
                lock: true,
                title: title,
                content: document.getElementById(id),
                btn: {                      //可以任意定义按钮个数
                    ok: {                     //按钮的key值，下次可用个btn方法从新设置
                        val: '确定',  //按钮显示的文本
                        type: 'orange',
                        click: function () {
                            return;
                        }
                    },
                    canle: {                     //按钮的key值，下次可用个btn方法从新设置
                        val: '取消',
                    }
                },
                init: function () {

                },
            });

        }
    </script>
    
</body>
</html>
